CC = gcc
CFLAGS = -g -Wall -Wextra -pthread
LDFLAGS = -lpthread

TARGETS = server client simulator

all: $(TARGETS)

server: server.c common.c cJSON.c queue.c threadpool.c log.c heartbeat.c
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

client: client.c common.c cJSON.c log.c
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

simulator: simulator.c common.c cJSON.c log.c heartbeat.c
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

clean:
	rm -f $(TARGETS) *.o

.PHONY: all clean